package org.sbbs.admin.service;

import org.sbbs.admin.manager.SysUserManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 *
 * @author jenkins
 */
@Component
public class SysUserDetailService implements UserDetailsService {

    @Autowired
    private SysUserManager sysUserManager;
    @Autowired
    PasswordEncoder passwordEncoder;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return this.sysUserManager.findUserByUserName(username);
    }

}
